import React,{useState,useContext} from 'react';
import NavContext from '../../store/cart-context';

const ChildMenu21 = (props) => {
    console.log(props)
    const [KeyWord, setKeyWord] = useState("子菜单2-1");
    const ntx = useContext(NavContext)
    const modify = (e) =>{
        setKeyWord(e.target.value.trim())
    }
    const btnModify = () =>{
        console.log(ntx)
        ntx.NavDispatch({path:props.location.pathname,name:KeyWord})
    }
    return (
        <div style={{width:'100%',height:'100%',margin:'20px 0 0 20px'}}>
            <input type="text" value={KeyWord} onChange={modify} />
            <button onClick={btnModify}>保存</button>
        </div>
    );
};

export default ChildMenu21;